package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.dao.OrdersettinglistDao;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.Ordersettinglist;
import com.itheima.service.OrdersettinglistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

@Service(interfaceClass = OrdersettinglistService.class)
@Transactional
public class OrdersettinglistServiceImpl implements OrdersettinglistService {
    @Autowired
    private OrdersettinglistDao ordersettinglistDao;
    @Override
    public PageResult pageQuery(QueryPageBean queryPageBean) {

        Integer currentPage = queryPageBean.getCurrentPage();
        Integer pageSize = queryPageBean.getPageSize();
        String queryString = queryPageBean.getQueryString();
        PageHelper.startPage(currentPage,pageSize);
        Page<Map<String,Object>> page = ordersettinglistDao.findByCondition(queryString);
        return new PageResult(page.getTotal(),page.getResult());
    }
}
